package com.example.test.mapper;

import com.example.test.entity.Look;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface LookMapper {

    @Insert("INSERT INTO look (username, time, itemName) " +
            "VALUES (#{username}, #{time}, #{itemName})")
    @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
    int insertLook(Look look);

    @Select("SELECT * FROM look")
    List<Look> getAllLooks();

    @Select("SELECT * FROM look ORDER BY id DESC LIMIT 6")
    List<Look> getLastSixLooks();
}

